package com.sk.bilibili.view.fragment.live;

import com.alibaba.android.vlayout.DelegateAdapter;
import com.sk.bilibili.adapter.vlayout.live.HistoryAdapter;
import com.sk.bilibili.bean.History;
import com.sk.bilibili.bean.Live;
import com.sk.bilibili.callBack.LiveClickCallBack;
import com.sk.bilibili.model.fragment.live.HistoryModel;
import com.sk.bilibili.model.fragment.live.RecommendModel;
import com.sk.bilibili.view.activity.MemberActivity;
import com.sk.bilibili.view.fragment.BaseRefreshFragment;

import java.util.List;

public class HistoryFragment extends BaseRefreshFragment<HistoryModel>  {

    private HistoryAdapter historyAdapter;

    @Override
    protected void initAdapter(DelegateAdapter adapter) {
        historyAdapter = new HistoryAdapter(getContext(), this);
        adapter.addAdapter(historyAdapter);
    }

    public void onLiveClick(Live live) {
        toast("历史直播不支持播放");
    }

    public void setData(List<History> records) {
        historyAdapter.setData(records);
        cancelRefresh();
    }

    public void addData(List<History> records) {
        if(records.isEmpty()){
            toast("全部加载完毕");
            return;
        }
        historyAdapter.addData(records);
    }

    public void onMemberClick(Integer id) {
        MemberActivity.start(getContext(),id);
    }

}